import { getAbout } from "../api/about.js";

export default {
  namespaced: true,
  state: {
    isLoading: false,
    data: "",
  },
  mutations: {
    setIsLoading(state, payload) {
      state.isLoading = payload;
    },
    setData(state, payload) {
      state.data = payload;
    },
  },
  actions: {
    async fetchData(ctx) {
      if(ctx.state.data){
        return
      }
      ctx.commit("setIsLoading", true);
      const resp = await getAbout();
      console.log(resp);
      ctx.commit("setData", resp);
      ctx.commit("setIsLoading", false);
    },
  },
};
